package com.itheima.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/*
Collection  的遍历
 */
public class Demo03 {

    public static void main(String[] args) {
        Collection<String > c= new ArrayList<>();
        c.add("坤坤");
        c.add("签签");
        c.add("滔滔");
        c.add("小鹿");
        c.add("小绵羊");
        //获取迭代器
        Iterator<String> iterator = c.iterator();
        while ( iterator.hasNext()) {
                String s = iterator.next();
                System.out.println(s);
        }
    }
}
